<template>
    <view class="pub_page pub_page_bg pub_wallet_log pub_header_padding">
        <pub-head headerName="wallet_log" :headerConfig="headerConfig"></pub-head>
        <div class="pub_page_scroll page_box">
            <z-paging ref="Zpaging" class="lis_div" v-model="list" @query="getList" :refresher-enabled="false"
                :fixed="false">
                <div class="lis">
                    <div class="li" v-for="(li, key) in list" :key="key">
                        <div class="time">{{ li.createTime }} <span class="status">{{ getStatusTxt(li.status)}}</span>
                        </div>
                        <div class="txts" v-if="openType == 'withdraw'">
                            <div class="txt">
                                <div class="p_1">提现金额</div>
                                <div class="p_2">{{ li.totalMoney }}</div>
                            </div>
                            <div class="txt">
                                <div class="p_1">手续费金额</div>
                                <div class="p_2">{{ li.serviceCharge }}</div>
                            </div>
                            <div class="txt">
                                <div class="p_1">到账金额</div>
                                <div class="p_2">{{ li.money }}</div>
                            </div>
                        </div>
                        <div class="rtxt" v-if="openType == 'recharge'">充值金额： <span>{{ li.num }}</span></div>
                    </div>
                </div>
            </z-paging>
        </div>
    </view>
</template>

<script>
export default {
    data() {
        return {
            pagescrollTop: 0,
            headerConfig: {
                title: '日志',//标题栏内容
                left_type: 3,
            },

            openType: '',//值见openTypeName
            openTypeName: {
                'recharge': 'USDT充值记录',
                'withdraw': 'USDT提现记录'
            },
            url: {
                'recharge': 'user/rechargeApplyLog',
                'withdraw': 'user/getWithdrawalsPage'
            },

            list: [],
        };
    },
    computed: {
        
    },
    onLoad(option) {
        // console.log(option);
        this.openType = option.openType || '';
        this.value = option.value || 0;
        this.headerConfig.title = this.openTypeName[this.openType];

        setTimeout(() => {
            this.$comFun.openLoading();
            this.$refs.Zpaging.reload()
        }, 400);
    },
    onPageScroll(res) {
        this.pagescrollTop = res.scrollTop;
    },
    methods: {
        getStatusTxt(status) {
            let arr = ['', '待审核', '已通过', '已驳回'];
            return arr[status]
        },
        async getList(pageNo, pageSize) {
            const res = await this.$request.get(this.url[this.openType], {
                pageNo: pageNo,
                pageSize: pageSize,
            });
            this.$comFun.closeLoading();
            // console.log(res);
            if (res.code == 200) {
                this.$refs.Zpaging.complete(res.result.records);
            } else {
                this.$refs.Zpaging.complete(false);
            }
        }
    },
};
</script>

<style lang="scss" scoped>
@import "@/common/css/mine.scss";
</style>
